package com.bailian.system.service.impl;

import java.util.List;
import com.bailian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bailian.system.mapper.BlAppointmentMapper;
import com.bailian.system.domain.BlAppointment;
import com.bailian.system.domain.vo.BlAppointmentVo;
import com.bailian.system.service.IBlAppointmentService;

/**
 * 仓库预约列表Service业务层处理
 * 
 * @author bailian
 * @date 2025-08-04
 */
@Service
public class BlAppointmentServiceImpl implements IBlAppointmentService 
{
    @Autowired
    private BlAppointmentMapper blAppointmentMapper;

    /**
     * 查询仓库预约列表
     * 
     * @param appointmentId 仓库预约列表主键
     * @return 仓库预约列表
     */
    @Override
    public BlAppointment selectBlAppointmentByAppointmentId(Long appointmentId)
    {
        return blAppointmentMapper.selectBlAppointmentByAppointmentId(appointmentId);
    }

    /**
     * 查询仓库预约列表列表
     * 
     * @param blAppointment 仓库预约列表
     * @return 仓库预约列表
     */
    @Override
    public List<BlAppointment> selectBlAppointmentList(BlAppointment blAppointment)
    {
        return blAppointmentMapper.selectBlAppointmentList(blAppointment);
    }

    /**
     * 新增仓库预约列表
     * 
     * @param blAppointment 仓库预约列表
     * @return 结果
     */
    @Override
    public int insertBlAppointment(BlAppointment blAppointment)
    {
        blAppointment.setCreateTime(DateUtils.getNowDate());
        return blAppointmentMapper.insertBlAppointment(blAppointment);
    }

    /**
     * 修改仓库预约列表
     * 
     * @param blAppointment 仓库预约列表
     * @return 结果
     */
    @Override
    public int updateBlAppointment(BlAppointment blAppointment)
    {
        blAppointment.setUpdateTime(DateUtils.getNowDate());
        return blAppointmentMapper.updateBlAppointment(blAppointment);
    }

    /**
     * 批量删除仓库预约列表
     * 
     * @param appointmentIds 需要删除的仓库预约列表主键
     * @return 结果
     */
    @Override
    public int deleteBlAppointmentByAppointmentIds(Long[] appointmentIds)
    {
        return blAppointmentMapper.deleteBlAppointmentByAppointmentIds(appointmentIds);
    }

    /**
     * 删除仓库预约列表信息
     * 
     * @param appointmentId 仓库预约列表主键
     * @return 结果
     */
    @Override
    public int deleteBlAppointmentByAppointmentId(Long appointmentId)
    {
        return blAppointmentMapper.deleteBlAppointmentByAppointmentId(appointmentId);
    }

    // ========== 关联查询方法实现 ==========
    
    /**
     * 查询仓库预约列表（包含关联的仓库、用户、园区信息）
     * 
     * @param blAppointment 仓库预约列表查询条件
     * @return 仓库预约列表视图对象集合
     */
    @Override
    public List<BlAppointmentVo> selectBlAppointmentVoList(BlAppointment blAppointment)
    {
        return blAppointmentMapper.selectBlAppointmentVoList(blAppointment);
    }

    /**
     * 查询仓库预约详情（包含关联的仓库、用户、园区信息）
     * 
     * @param appointmentId 仓库预约列表主键
     * @return 仓库预约列表视图对象
     */
    @Override
    public BlAppointmentVo selectBlAppointmentVoByAppointmentId(Long appointmentId)
    {
        return blAppointmentMapper.selectBlAppointmentVoByAppointmentId(appointmentId);
    }
}
